//
//  LottieEmptyView.swift
//  DaRings
//
//  Created by 尹琼 on 2022/12/5.
//

import UIKit
import Lottie
import MYModule

open class LottieEmptyView: View {
    
    public let animationView = AnimationView()
    
    public required init(named: String = "img_nodata") {
        super.init(frame: CGRect.zero)
       
        animationView.animation = Animation.named(named, bundle: Bundle(for: LottieEmptyView.self))
        animationView.contentMode = .scaleAspectFit // 填充模式
        animationView.loopMode = .autoReverse // 动画播放次数
        animationView.backgroundBehavior = .pauseAndRestore // 后台模式
        animationView.play()
        
        addSubview(animationView)
        
        animationView.snp.makeConstraints { make in
            make.center.equalToSuperview()
            make.width.equalTo(120)
            make.height.equalTo(140)
            
        }
       
    }
    
    public required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
  
}
